UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'q9NkoRGJQiFKUrvsnRP5Vii2o1wHYmVYaZA8gudqaBo=' 
WHERE 
  key_id = 'acaabdcf2afef52937ab1a0c09a63b7c24192d128f68e2dc18a85ca2f506f1cf' 
  AND (
    token = 'q9NkoRGJQiFKUrvsnRP5Vii2o1wHYmVYaZA8gudqaBo=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032