UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'LDQiIphoJP77SRQgey81Ita6DBMg1SOFzd5Db1D+D7w=' 
WHERE 
  key_id = 'ac254d88b877d74e2c43b0bb68c6613907633d958fc47d65870e95e769cd971f' 
  AND (
    token = 'LDQiIphoJP77SRQgey81Ita6DBMg1SOFzd5Db1D+D7w=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00040