UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'bj+FfcGiqGMNV7BT7VXbxatERa/Daowe7rZ1SVRFFEI=' 
WHERE 
  key_id = 'b7528532d711a2f2b1489472fcd1bfc2043cae08caa9ddecf50baa8049976266' 
  AND (
    token = 'bj+FfcGiqGMNV7BT7VXbxatERa/Daowe7rZ1SVRFFEI=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00041