UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'gc5YnzKND62kQf1l+EP01eYRgve5rVDGNzDngqXPrkE=' 
WHERE 
  key_id = 'ddc89ef3e537e9051cedffb770741bd86ebe24342ec3351eb615f133041b1fc7' 
  AND (
    token = 'gc5YnzKND62kQf1l+EP01eYRgve5rVDGNzDngqXPrkE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00020