UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'B5sI3yUVwwLH48gHH0Z9cHiWKCU6uTejqwVx/Rbwz8M=' 
WHERE 
  key_id = 'e0afbb430cac5b373524f1478053c7810201395a1d8dc20ae13402a68893c902' 
  AND (
    token = 'B5sI3yUVwwLH48gHH0Z9cHiWKCU6uTejqwVx/Rbwz8M=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00044