UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'AGxiAhu+6KT0CO7V5sxh/r/lylzjPilwAhuUM/R3mWQ=' 
WHERE 
  key_id = 'aae2a619e55dfffbe49a094bf5c1ce6c210c521cb18733b44755836bd487544a' 
  AND (
    token = 'AGxiAhu+6KT0CO7V5sxh/r/lylzjPilwAhuUM/R3mWQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00040