UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'iQ8vtPB7lPqCcBWrIjPQvTGxp00ZsTs1ZsO1SCNcEdI=' 
WHERE 
  key_id = '9a12d1ad42583165c974e48bf786b93fee8faad55b36a2afabadfbb9a2cf526a' 
  AND (
    token = 'iQ8vtPB7lPqCcBWrIjPQvTGxp00ZsTs1ZsO1SCNcEdI=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00028