UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Tx9YldgQLDBwVJHQcfdXatYmndKb9KuUll7dNFL2CUo=' 
WHERE 
  key_id = '5dede706bff8dce831082a6c095ed342c90a8510236cae1fd16813be9791f726' 
  AND (
    token = 'Tx9YldgQLDBwVJHQcfdXatYmndKb9KuUll7dNFL2CUo=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00025