UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'TVs99veI5OLo4fUjI55p6vVWptfoE7lCRspVzNCi6Ac=' 
WHERE 
  key_id = 'ceaeca4aa50852d086e46257d9fdba2f525ab7dd3855f151662b8e42079bffa2' 
  AND (
    token = 'TVs99veI5OLo4fUjI55p6vVWptfoE7lCRspVzNCi6Ac=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00028