UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'gPzdQJaSKZ5R214uZkqG+67OGapWZr3LgUq206BAM3E=' 
WHERE 
  key_id = '2b009f4a4c5987d3c5d77f369e3896e268e3b6df8b1f2ed85e6f923c009972d9' 
  AND (
    token = 'gPzdQJaSKZ5R214uZkqG+67OGapWZr3LgUq206BAM3E=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00026