UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '2SKY87pwX0MV75WF8BSU+JzwIm24z28nmUPrB+uLzdo=' 
WHERE 
  key_id = 'ff1289d2aace1cc674d30f5a5ebe1a9f74217c5e461298cd14e61e4fecd54f7f' 
  AND (
    token = '2SKY87pwX0MV75WF8BSU+JzwIm24z28nmUPrB+uLzdo=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00016