UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'u6m3DTOx9koqAPq5+vZILVIPKuDEk4s022Z4zxBY7vg=' 
WHERE 
  key_id = '2513a7b749e2b2dba1973ddf8d9ddb959435b731740dad13fdb816e5ce96aea5' 
  AND (
    token = 'u6m3DTOx9koqAPq5+vZILVIPKuDEk4s022Z4zxBY7vg=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00030