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

Query time 0.00032