UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'hM9NI13AX8XpkoPXP8w5Bq7uqVaRXseA3fiCPOtzQ94=' 
WHERE 
  key_id = '3cbdf94660b6a2da07a2225ddd1fbed8a9b415afd21418daffcb064008f6599e' 
  AND (
    token = 'hM9NI13AX8XpkoPXP8w5Bq7uqVaRXseA3fiCPOtzQ94=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00022