UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Whr4M53l/vZqPziZO2nRPrr8zBv+5wY1ekwFPSVLr5I=' 
WHERE 
  key_id = '7cd857fc81c99c412e5c6632fac505eaf65cb5edbf403b8fd4579c9b23e767fe' 
  AND (
    token = 'Whr4M53l/vZqPziZO2nRPrr8zBv+5wY1ekwFPSVLr5I=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00026