UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'a/BmdM0fJq54kCRjjwRFY/00RzhJ/b9HKs+4A3o+WRk=' 
WHERE 
  key_id = '52ff2a1341d7fa73cca94816767c5da50e4f65b7025e407aa14dd65078fdb449' 
  AND (
    token = 'a/BmdM0fJq54kCRjjwRFY/00RzhJ/b9HKs+4A3o+WRk=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00018