UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'msozOlqPNJh/JT1d+MhzqBvxz0MZ1GV4nqKfLtXK0mE=' 
WHERE 
  key_id = 'e4b2ab496ca4d608eee327099c1ba8323eb8d009f9daae12cd20577116fd8b04' 
  AND (
    token = 'msozOlqPNJh/JT1d+MhzqBvxz0MZ1GV4nqKfLtXK0mE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032