UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'TuI02U3r11/xPJS0+eC+fm8zl041gsztMD2NW4gepRI=' 
WHERE 
  key_id = '5baa2679eee7188f8fb1128b7549743c0c1c7d356517d6f3c29f34e63162df4a' 
  AND (
    token = 'TuI02U3r11/xPJS0+eC+fm8zl041gsztMD2NW4gepRI=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00018