UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'CkafZ1l//jzb6wtDA/60hxqUgThMB4v2egs/I82Xnfo=' 
WHERE 
  key_id = '2fb3852fa5a8f30e370fb81acf777abcd6ba1e37341e2b01a61199ae26f4b4b9' 
  AND (
    token = 'CkafZ1l//jzb6wtDA/60hxqUgThMB4v2egs/I82Xnfo=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00026