UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'GIUzWW1a+F4U2Z+tCazmfe1ud3v/va056/mDy4vmtqc=' 
WHERE 
  key_id = 'd476dbbade93ac2ceb04c612b3f3f51efca93f36a7dfc9d9b0da2d17ac884178' 
  AND (
    token = 'GIUzWW1a+F4U2Z+tCazmfe1ud3v/va056/mDy4vmtqc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00029