UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'vbIDeLgsrnduuwDBs4Zy2Yfk5RUE30Nkhz91OtKA2tw=' 
WHERE 
  key_id = '9b4ddf7cad20d54523a05635fec45596faf9ca2c29134a9cfb37723c7be561bf' 
  AND (
    token = 'vbIDeLgsrnduuwDBs4Zy2Yfk5RUE30Nkhz91OtKA2tw=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00079