UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'YRSPeeS9Ni/PMd0VuWyS+0lvxh60Xcig4a3Xec71/8w=' 
WHERE 
  key_id = '0b63e2a78e2ac522cedccd9284e88e57bb1b34413b702ceeca43c9b821e9704e' 
  AND (
    token = 'YRSPeeS9Ni/PMd0VuWyS+0lvxh60Xcig4a3Xec71/8w=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00042