UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '5KYn36NuB/F7s5nx+sMixM/vbmdSUiF3RHVzkgnaGEs=' 
WHERE 
  key_id = 'fc48aacb2a8210d8f5886a6662bd59d57878054f010312ae7505c2c04bc980da' 
  AND (
    token = '5KYn36NuB/F7s5nx+sMixM/vbmdSUiF3RHVzkgnaGEs=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00088