UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'EnVdsReVIp4z1nKuid+j8L2+gh9z+Xi8Bd7HNNBDmy8=' 
WHERE 
  key_id = '82bdb6fa56c882c8d1cbc5a2505414060204bda0beaff109e971aca5a884e3d8' 
  AND (
    token = 'EnVdsReVIp4z1nKuid+j8L2+gh9z+Xi8Bd7HNNBDmy8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00023