UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'PtZKwFW9uJ1l/nXo39wQ+r9U0Ond5mNkbCyb7mtY9PA=' 
WHERE 
  key_id = '8611ee1dcdfd11e81e55053eb26675ccefd822302db2be460fe31da5c9dea476' 
  AND (
    token = 'PtZKwFW9uJ1l/nXo39wQ+r9U0Ond5mNkbCyb7mtY9PA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00029