UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'llBdWjcH5t6Qc6Se3I8h2i4ezotqzUqS1OCaGOzJ+ZI=' 
WHERE 
  key_id = '57aec79c31ee2dfd73bdcbe727cead4d2008e8674dbee93aa42c60f45d6c2e71' 
  AND (
    token = 'llBdWjcH5t6Qc6Se3I8h2i4ezotqzUqS1OCaGOzJ+ZI=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00025