UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'hvMztRtaobgDTDAiGcBf/MdNuSAvwaZnVqIGZvIew+s=' 
WHERE 
  key_id = '8fe3b80a0bd96416ea7062d2396a0e8c7b2ce65464bb6adea46993cae45db86d' 
  AND (
    token = 'hvMztRtaobgDTDAiGcBf/MdNuSAvwaZnVqIGZvIew+s=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00034