UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '4clwRL4VbIhPR6qD2UewNqIcOk7shZZJx4wGFcSSp30=' 
WHERE 
  key_id = 'fe042654e8acb18d5981062442d239edd52b77af7a3f6bb3db8f3ba6afcfb5c7' 
  AND (
    token = '4clwRL4VbIhPR6qD2UewNqIcOk7shZZJx4wGFcSSp30=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00044