UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '0IeeFZYKskI3k9QczUB3HNoAReT1iT9TwXa9DeDrEWE=' 
WHERE 
  key_id = 'd9e541db1bfdec20cf5e90fb980a6e1861a235e86b6c22bd281e24b7b98c80c4' 
  AND (
    token = '0IeeFZYKskI3k9QczUB3HNoAReT1iT9TwXa9DeDrEWE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00031